if not ( RES_DISTRIB == 2 ) then Error("Please Install Resource Distribution 2 Addon.'" ) return end

TOOL.Category = '(Dominion Wars)'
TOOL.Name = '#Generators'
TOOL.Command = nil
TOOL.ConfigName = ''
if (CLIENT and GetConVarNumber("RD_UseLSTab") == 1) then TOOL.Tab = "Life Support" end

TOOL.ClientConVar['type'] = 'air_compressor'
TOOL.ClientConVar['model'] = 'models/props_wasteland/laundry_washer003.mdl'

cleanup.Register('DWenergysystem')

if ( CLIENT ) then
	language.Add( 'Tool_domenergysystems_name', 'Dominion Wars Life Support Generators' )
	language.Add( 'Tool_domenergysystems_desc', 'Create Generators attached to any surface.' )
	language.Add( 'Tool_domenergysystems_0', 'Left-Click: Spawn a Device.  Right-Click: Repair Device.' )

	language.Add( 'Undone_domenergysystems', 'Dominion Wars Generator Undone' )
	language.Add( 'Cleanup_domenergysystems', 'Dominion Wars LS: Generators' )
	language.Add( 'Cleaned_domenergysystems', 'Cleaned up all Dominion Wars Life Support Generators' )
	language.Add( 'SBoxLimit_domenergysystems', 'Maximum Dominion Wars Life Support Generators Reached' )
end

local domenergysystems = {}
if (SERVER) then

	domenergysystems.superhvywater_electrolyzer = function( ply, ent, system_type, system_class, model )
		local maxhealth = 1200
		local mass = 7500
		RD_AddResource(ent, "energy", 0)
		RD_AddResource(ent, "water", 0)
		RD_AddResource(ent, "heavy water", 0)
		LS_RegisterEnt(ent, "Generator")
		return {}, maxhealth, mass
	end
	
	domenergysystems.neutrion_generator = function( ply, ent, system_type, system_class, model )
		local maxhealth = 1200
		local mass = 3000
		RD_AddResource(ent, "neutrions", 0)
		RD_AddResource(ent, "heavy water", 0)
		LS_RegisterEnt(ent, "Generator")
		return {}, maxhealth, mass
	end
		
	domenergysystems.neutrion_power_facility = function( ply, ent, system_type, system_class, model )
		local maxhealth = 1200
		local mass = 3000
		RD_AddResource(ent, "neutrions", 0)
		RD_AddResource(ent, "heavy water", 0)
		RD_AddResource(ent, "energy", 0)
		LS_RegisterEnt(ent, "Generator")
		return {}, maxhealth, mass
	end	
	
	
	domenergysystems.ambneutroniccollecter = function( ply, ent, system_type, system_class, model )
		local maxhealth = 1200
		local mass = 3000
		RD_AddResource(ent, "neutrions", 50)
		RD_AddResource(ent, "energy", 0)
		LS_RegisterEnt(ent, "Generator")
		return {}, maxhealth, mass
	end	
	

end

local energysystem_models = {
	{ 'Neutrion Generator', 'models/props/cs_assault/ConsolePanelLoadingBay.mdl', 'neutrion_generator' },
	{ 'Neutrionic Power Facility', 'models/props_wasteland/laundry_washer001a.mdl', 'neutrion_power_facility' },
	{ 'Ambient Neutrionc Collector', 'models/props_c17/utilitypole03a.mdl', 'ambneutroniccollecter' },
	{ 'Super Heavy Water Electrolyzer', 'models/props_combine/CombineThumper002.mdl', 'superhvywater_electrolyzer' }

}

RD2_ToolRegister( TOOL, energysystem_models, nil, "domenergysystems", 10, domenergysystems )
